package mission_tour.solution;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserFactory;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;

public class tour_lookback extends Activity implements ServerIp{
    /** Called when the activity is first created. */
	AlertDialog.Builder nologin;
	String[] resultString =null;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tour_lookback);
        
        final ProgressDialog nowloding = ProgressDialog.show(tour_lookback.this,"","정보를 불러오고 있습니다....",true);
        
        final TextView t_position1 = (TextView) findViewById(R.id.t_position1);
        final TextView t_position2 = (TextView) findViewById(R.id.t_position2);
        final TextView t_position3 = (TextView) findViewById(R.id.t_position3);
        final TextView t_position4 = (TextView) findViewById(R.id.t_position4);
        final TextView t_position5 = (TextView) findViewById(R.id.t_position5);
        final TextView t_position6 = (TextView) findViewById(R.id.t_position6);
        final TextView t_position7 = (TextView) findViewById(R.id.t_position7);
        final TextView t_position8 = (TextView) findViewById(R.id.t_position8);
        final TextView t_position9 = (TextView) findViewById(R.id.t_position9);
        final TextView t_position10 = (TextView) findViewById(R.id.t_position10);
        final TextView t_position11 = (TextView) findViewById(R.id.t_position11);
        
        t_position1.setOnClickListener(new View.OnClickListener(){
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				items.event_list.removeAll(items.event_list);
				items.event_position = 0;
				
	    		final ProgressDialog nowloding = ProgressDialog.show(tour_lookback.this,"","미션을 불러오고 있습니다....",true);
	    		
	    		new Thread(new Runnable() {    
					@Override
					public void run() {				 
						try{
			    			
				    		URL url = null;
					        String resultString =null;
					  
				        	url = new URL(tour_oxquiz_recall+"?app_type="+items.apptype+"&lookback_name="+URLEncoder.encode(t_position1.getText().toString()));
						
				        	HttpURLConnection http = (HttpURLConnection)url.openConnection();  
				        	
				        	BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));  
				        	StringBuffer buffer = new StringBuffer();
							 
				        	int z;
				        	
							while((z=in.read()) != -1){
								buffer.append((char)z);
							}
							
							resultString= buffer.toString().trim();
							
				            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
				            factory.setNamespaceAware(true);
				            
				            boolean tagok = false;
				            
				            String[] quiz_call = null;
				            
				            XmlPullParser xpp = factory.newPullParser();
				            xpp.setInput(new StringReader(resultString));
				            
				            int eventType = xpp.getEventType();
				            
				            while (eventType != XmlPullParser.END_DOCUMENT) {
				                
				            	if(eventType == XmlPullParser.START_DOCUMENT) {
				                    System.out.println("Start document");
				                }
				            	
				            	if (eventType == XmlPullParser.END_DOCUMENT) {
				                    System.out.println("End document");
				                }
				            	
				            	if (eventType == XmlPullParser.START_TAG) {
				            		
				            		if(xpp.getName().equals("name")){
				            			tagok = true;
				            		}
				                }
				            	
				            	if (eventType == XmlPullParser.END_TAG) {
				                }
				            	
				            	if (eventType == XmlPullParser.TEXT) {
				            		if(tagok){
				            			quiz_call = xpp.getText().split(",");
				                	}
				            		quizs qs = new quizs(quiz_call[0],quiz_call[1],quiz_call[2],quiz_call[3],quiz_call[4],quiz_call[5],quiz_call[6],Integer.parseInt(quiz_call[7]),Integer.parseInt(quiz_call[8]),quiz_call[9],Integer.parseInt(quiz_call[10]));
						            
				            		items.event_list.add(qs);
				                }
				                eventType = xpp.next();
				            }
				            
				            items.event_position = Integer.parseInt(quiz_call[11]);
				            nowloding.cancel();
				            
				            if(items.event_list.get(0).getQuiz_type() == 3){
				            	Intent intent = new Intent(tour_lookback.this, tour_error_picture_search.class);
								startActivityForResult(intent, 0);
								finish();
				            }else if(items.event_list.get(0).getQuiz_type() == 1){
				            	Intent intent = new Intent(tour_lookback.this, tour_oxquiz.class);
								startActivityForResult(intent, 0);
								finish();
				            }
						} catch (MalformedURLException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						} catch (IOException e) {
							// TODO Auto-generated catch block								
							e.printStackTrace();
						}catch(Exception e){
							System.out.println(e.toString());
						}
					}
			    }).start();
			}
		});
        t_position2.setOnClickListener(new View.OnClickListener(){
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				
				items.event_list.removeAll(items.event_list);
				items.event_position = 0;
				
	    		final ProgressDialog nowloding = ProgressDialog.show(tour_lookback.this,"","미션을 불러오고 있습니다....",true);
	    		
	    		new Thread(new Runnable() {    
					@Override
					public void run() {				 
						try{
			    			
				    		URL url = null;
					        String resultString =null;
					  
				        	url = new URL(tour_oxquiz_recall+"?app_type="+items.apptype+"&lookback_name="+URLEncoder.encode(t_position2.getText().toString()));
						
				        	HttpURLConnection http = (HttpURLConnection)url.openConnection();  
				        	
				        	BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));  
				        	StringBuffer buffer = new StringBuffer();
							 
				        	int z;
				        	
							while((z=in.read()) != -1){
								buffer.append((char)z);
							}
							
							resultString= buffer.toString().trim();
							
				            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
				            factory.setNamespaceAware(true);
				            
				            boolean tagok = false;
				            
				            String[] quiz_call = null;
				            
				            XmlPullParser xpp = factory.newPullParser();
				            xpp.setInput(new StringReader(resultString));
				            
				            int eventType = xpp.getEventType();
				            
				            while (eventType != XmlPullParser.END_DOCUMENT) {
				                
				            	if(eventType == XmlPullParser.START_DOCUMENT) {
				                    System.out.println("Start document");
				                }
				            	
				            	if (eventType == XmlPullParser.END_DOCUMENT) {
				                    System.out.println("End document");
				                }
				            	
				            	if (eventType == XmlPullParser.START_TAG) {
				            		
				            		if(xpp.getName().equals("name")){
				            			tagok = true;
				            		}
				                }
				            	
				            	if (eventType == XmlPullParser.END_TAG) {
				                }
				            	
				            	if (eventType == XmlPullParser.TEXT) {
				            		if(tagok){
				            			quiz_call = xpp.getText().split(",");
				                	}
				            		quizs qs = new quizs(quiz_call[0],quiz_call[1],quiz_call[2],quiz_call[3],quiz_call[4],quiz_call[5],quiz_call[6],Integer.parseInt(quiz_call[7]),Integer.parseInt(quiz_call[8]),quiz_call[9],Integer.parseInt(quiz_call[10]));
						            
				            		items.event_list.add(qs);
				                }
				                eventType = xpp.next();
				            }
				            items.event_position = Integer.parseInt(quiz_call[11]);
				            nowloding.cancel();
				            if(items.event_list.get(0).getQuiz_type() == 3){
				            	Intent intent = new Intent(tour_lookback.this, tour_error_picture_search.class);
								startActivityForResult(intent, 0);
								finish();
				            }else if(items.event_list.get(0).getQuiz_type() == 1){
				            	Intent intent = new Intent(tour_lookback.this, tour_oxquiz.class);
								startActivityForResult(intent, 0);
								finish();
				            }
						} catch (MalformedURLException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						} catch (IOException e) {
							// TODO Auto-generated catch block								
							e.printStackTrace();
						}catch(Exception e){
							System.out.println(e.toString());
						}
					}
			    }).start();
	    		
			}
		});
        t_position3.setOnClickListener(new View.OnClickListener(){
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				items.event_list.removeAll(items.event_list);
				items.event_position = 0;
				
	    		final ProgressDialog nowloding = ProgressDialog.show(tour_lookback.this,"","미션을 불러오고 있습니다....",true);
	    		
	    		new Thread(new Runnable() {    
					@Override
					public void run() {				 
						try{
			    			
				    		URL url = null;
					        String resultString =null;
					  
				        	url = new URL(tour_oxquiz_recall+"?app_type="+items.apptype+"&lookback_name="+URLEncoder.encode(t_position3.getText().toString()));
						
				        	HttpURLConnection http = (HttpURLConnection)url.openConnection();  
				        	
				        	BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));  
				        	StringBuffer buffer = new StringBuffer();
							 
				        	int z;
				        	
							while((z=in.read()) != -1){
								buffer.append((char)z);
							}
							
							resultString= buffer.toString().trim();
							
				            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
				            factory.setNamespaceAware(true);
				            
				            boolean tagok = false;
				            
				            String[] quiz_call = null;
				            
				            XmlPullParser xpp = factory.newPullParser();
				            xpp.setInput(new StringReader(resultString));
				            
				            int eventType = xpp.getEventType();
				            
				            while (eventType != XmlPullParser.END_DOCUMENT) {
				                
				            	if(eventType == XmlPullParser.START_DOCUMENT) {
				                    System.out.println("Start document");
				                }
				            	
				            	if (eventType == XmlPullParser.END_DOCUMENT) {
				                    System.out.println("End document");
				                }
				            	
				            	if (eventType == XmlPullParser.START_TAG) {
				            		
				            		if(xpp.getName().equals("name")){
				            			tagok = true;
				            		}
				                }
				            	
				            	if (eventType == XmlPullParser.END_TAG) {
				                }
				            	
				            	if (eventType == XmlPullParser.TEXT) {
				            		if(tagok){
				            			quiz_call = xpp.getText().split(",");
				                	}
				            		quizs qs = new quizs(quiz_call[0],quiz_call[1],quiz_call[2],quiz_call[3],quiz_call[4],quiz_call[5],quiz_call[6],Integer.parseInt(quiz_call[7]),Integer.parseInt(quiz_call[8]),quiz_call[9],Integer.parseInt(quiz_call[10]));
						            
				            		items.event_list.add(qs);
				                }
				                eventType = xpp.next();
				            }
				            items.event_position = Integer.parseInt(quiz_call[11]);
				            nowloding.cancel();
				            if(items.event_list.get(0).getQuiz_type() == 3){
				            	Intent intent = new Intent(tour_lookback.this, tour_error_picture_search.class);
								startActivityForResult(intent, 0);
								finish();
				            }else if(items.event_list.get(0).getQuiz_type() == 1){
				            	Intent intent = new Intent(tour_lookback.this, tour_oxquiz.class);
								startActivityForResult(intent, 0);
								finish();
				            }
						} catch (MalformedURLException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						} catch (IOException e) {
							// TODO Auto-generated catch block								
							e.printStackTrace();
						}catch(Exception e){
							System.out.println(e.toString());
						}
					}
			    }).start();
			}
		});
        
		t_position4.setOnClickListener(new View.OnClickListener(){
					
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				items.event_list.removeAll(items.event_list);
				items.event_position = 0;
				
	    		final ProgressDialog nowloding = ProgressDialog.show(tour_lookback.this,"","미션을 불러오고 있습니다....",true);
	    		
	    		new Thread(new Runnable() {    
					@Override
					public void run() {				 
						try{
			    			
				    		URL url = null;
					        String resultString =null;
					  
				        	url = new URL(tour_oxquiz_recall+"?app_type="+items.apptype+"&lookback_name="+URLEncoder.encode(t_position4.getText().toString()));
						
				        	HttpURLConnection http = (HttpURLConnection)url.openConnection();  
				        	
				        	BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));  
				        	StringBuffer buffer = new StringBuffer();
							 
				        	int z;
				        	
							while((z=in.read()) != -1){
								buffer.append((char)z);
							}
							
							resultString= buffer.toString().trim();
							
				            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
				            factory.setNamespaceAware(true);
				            
				            boolean tagok = false;
				            
				            String[] quiz_call = null;
				            
				            XmlPullParser xpp = factory.newPullParser();
				            xpp.setInput(new StringReader(resultString));
				            
				            int eventType = xpp.getEventType();
				            
				            while (eventType != XmlPullParser.END_DOCUMENT) {
				                
				            	if(eventType == XmlPullParser.START_DOCUMENT) {
				                    System.out.println("Start document");
				                }
				            	
				            	if (eventType == XmlPullParser.END_DOCUMENT) {
				                    System.out.println("End document");
				                }
				            	
				            	if (eventType == XmlPullParser.START_TAG) {
				            		
				            		if(xpp.getName().equals("name")){
				            			tagok = true;
				            		}
				                }
				            	
				            	if (eventType == XmlPullParser.END_TAG) {
				                }
				            	
				            	if (eventType == XmlPullParser.TEXT) {
				            		if(tagok){
				            			quiz_call = xpp.getText().split(",");
				                	}
				            		quizs qs = new quizs(quiz_call[0],quiz_call[1],quiz_call[2],quiz_call[3],quiz_call[4],quiz_call[5],quiz_call[6],Integer.parseInt(quiz_call[7]),Integer.parseInt(quiz_call[8]),quiz_call[9],Integer.parseInt(quiz_call[10]));
						            
				            		items.event_list.add(qs);
				                }
				                eventType = xpp.next();
				            }
				            items.event_position = Integer.parseInt(quiz_call[11]);
				            nowloding.cancel();
				            if(items.event_list.get(0).getQuiz_type() == 3){
				            	Intent intent = new Intent(tour_lookback.this, tour_error_picture_search.class);
								startActivityForResult(intent, 0);
								finish();
				            }else if(items.event_list.get(0).getQuiz_type() == 1){
				            	Intent intent = new Intent(tour_lookback.this, tour_oxquiz.class);
								startActivityForResult(intent, 0);
								finish();
				            }
						} catch (MalformedURLException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						} catch (IOException e) {
							// TODO Auto-generated catch block								
							e.printStackTrace();
						}catch(Exception e){
							System.out.println(e.toString());
						}
					}
			    }).start();
			}
		});
		
		t_position5.setOnClickListener(new View.OnClickListener(){
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				items.event_list.removeAll(items.event_list);
				items.event_position = 0;
				
				final ProgressDialog nowloding = ProgressDialog.show(tour_lookback.this,"","미션을 불러오고 있습니다....",true);
				
				new Thread(new Runnable() {    
					@Override
					public void run() {				 
						try{
			    			
				    		URL url = null;
					        String resultString =null;
					  
				        	url = new URL(tour_oxquiz_recall+"?app_type="+items.apptype+"&lookback_name="+URLEncoder.encode(t_position5.getText().toString()));
						
				        	HttpURLConnection http = (HttpURLConnection)url.openConnection();  
				        	
				        	BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));  
				        	StringBuffer buffer = new StringBuffer();
							 
				        	int z;
				        	
							while((z=in.read()) != -1){
								buffer.append((char)z);
							}
							
							resultString= buffer.toString().trim();
							
				            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
				            factory.setNamespaceAware(true);
				            
				            boolean tagok = false;
				            
				            String[] quiz_call = null;
				            
				            XmlPullParser xpp = factory.newPullParser();
				            xpp.setInput(new StringReader(resultString));
				            
				            int eventType = xpp.getEventType();
				            
				            while (eventType != XmlPullParser.END_DOCUMENT) {
				                
				            	if(eventType == XmlPullParser.START_DOCUMENT) {
				                    System.out.println("Start document");
				                }
				            	
				            	if (eventType == XmlPullParser.END_DOCUMENT) {
				                    System.out.println("End document");
				                }
				            	
				            	if (eventType == XmlPullParser.START_TAG) {
				            		
				            		if(xpp.getName().equals("name")){
				            			tagok = true;
				            		}
				                }
				            	
				            	if (eventType == XmlPullParser.END_TAG) {
				                }
				            	
				            	if (eventType == XmlPullParser.TEXT) {
				            		if(tagok){
				            			quiz_call = xpp.getText().split(",");
				                	}
				            		quizs qs = new quizs(quiz_call[0],quiz_call[1],quiz_call[2],quiz_call[3],quiz_call[4],quiz_call[5],quiz_call[6],Integer.parseInt(quiz_call[7]),Integer.parseInt(quiz_call[8]),quiz_call[9],Integer.parseInt(quiz_call[10]));
						            
				            		items.event_list.add(qs);
				                }
				                eventType = xpp.next();
				            }
				            items.event_position = Integer.parseInt(quiz_call[11]);
				            nowloding.cancel();
				            if(items.event_list.get(0).getQuiz_type() == 3){
				            	Intent intent = new Intent(tour_lookback.this, tour_error_picture_search.class);
								startActivityForResult(intent, 0);
								finish();
				            }else if(items.event_list.get(0).getQuiz_type() == 1){
				            	Intent intent = new Intent(tour_lookback.this, tour_oxquiz.class);
								startActivityForResult(intent, 0);
								finish();
				            }
						} catch (MalformedURLException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						} catch (IOException e) {
							// TODO Auto-generated catch block								
							e.printStackTrace();
						}catch(Exception e){
							System.out.println(e.toString());
						}
					}
			    }).start();
			}
		});
		
		t_position6.setOnClickListener(new View.OnClickListener(){
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				items.event_list.removeAll(items.event_list);
				items.event_position = 0;
				
				final ProgressDialog nowloding = ProgressDialog.show(tour_lookback.this,"","미션을 불러오고 있습니다....",true);
				
				new Thread(new Runnable() {    
					@Override
					public void run() {				 
						try{
			    			
				    		URL url = null;
					        String resultString =null;
					  
				        	url = new URL(tour_oxquiz_recall+"?app_type="+items.apptype+"&lookback_name="+URLEncoder.encode(t_position6.getText().toString()));
						
				        	HttpURLConnection http = (HttpURLConnection)url.openConnection();  
				        	
				        	BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));  
				        	StringBuffer buffer = new StringBuffer();
							 
				        	int z;
				        	
							while((z=in.read()) != -1){
								buffer.append((char)z);
							}
							
							resultString= buffer.toString().trim();
							
				            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
				            factory.setNamespaceAware(true);
				            
				            boolean tagok = false;
				            
				            String[] quiz_call = null;
				            
				            XmlPullParser xpp = factory.newPullParser();
				            xpp.setInput(new StringReader(resultString));
				            
				            int eventType = xpp.getEventType();
				            
				            while (eventType != XmlPullParser.END_DOCUMENT) {
				                
				            	if(eventType == XmlPullParser.START_DOCUMENT) {
				                    System.out.println("Start document");
				                }
				            	
				            	if (eventType == XmlPullParser.END_DOCUMENT) {
				                    System.out.println("End document");
				                }
				            	
				            	if (eventType == XmlPullParser.START_TAG) {
				            		
				            		if(xpp.getName().equals("name")){
				            			tagok = true;
				            		}
				                }
				            	
				            	if (eventType == XmlPullParser.END_TAG) {
				                }
				            	
				            	if (eventType == XmlPullParser.TEXT) {
				            		if(tagok){
				            			quiz_call = xpp.getText().split(",");
				                	}
				            		quizs qs = new quizs(quiz_call[0],quiz_call[1],quiz_call[2],quiz_call[3],quiz_call[4],quiz_call[5],quiz_call[6],Integer.parseInt(quiz_call[7]),Integer.parseInt(quiz_call[8]),quiz_call[9],Integer.parseInt(quiz_call[10]));
						            
				            		items.event_list.add(qs);
				                }
				                eventType = xpp.next();
				            }
				            items.event_position = Integer.parseInt(quiz_call[11]);
				            nowloding.cancel();
				            if(items.event_list.get(0).getQuiz_type() == 3){
				            	Intent intent = new Intent(tour_lookback.this, tour_error_picture_search.class);
								startActivityForResult(intent, 0);
								finish();
				            }else if(items.event_list.get(0).getQuiz_type() == 1){
				            	Intent intent = new Intent(tour_lookback.this, tour_oxquiz.class);
								startActivityForResult(intent, 0);
								finish();
				            }
						} catch (MalformedURLException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						} catch (IOException e) {
							// TODO Auto-generated catch block								
							e.printStackTrace();
						}catch(Exception e){
							System.out.println(e.toString());
						}
					}
			    }).start();
			}
		});
		
		t_position7.setOnClickListener(new View.OnClickListener(){
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				items.event_list.removeAll(items.event_list);
				items.event_position = 0;
				
				final ProgressDialog nowloding = ProgressDialog.show(tour_lookback.this,"","미션을 불러오고 있습니다....",true);
				
				new Thread(new Runnable() {    
					@Override
					public void run() {				 
						try{
			    			
				    		URL url = null;
					        String resultString =null;
					  
				        	url = new URL(tour_oxquiz_recall+"?app_type="+items.apptype+"&lookback_name="+URLEncoder.encode(t_position7.getText().toString()));
						
				        	HttpURLConnection http = (HttpURLConnection)url.openConnection();  
				        	
				        	BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));  
				        	StringBuffer buffer = new StringBuffer();
							 
				        	int z;
				        	
							while((z=in.read()) != -1){
								buffer.append((char)z);
							}
							
							resultString= buffer.toString().trim();
							
				            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
				            factory.setNamespaceAware(true);
				            
				            boolean tagok = false;
				            
				            String[] quiz_call = null;
				            
				            XmlPullParser xpp = factory.newPullParser();
				            xpp.setInput(new StringReader(resultString));
				            
				            int eventType = xpp.getEventType();
				            
				            while (eventType != XmlPullParser.END_DOCUMENT) {
				                
				            	if(eventType == XmlPullParser.START_DOCUMENT) {
				                    System.out.println("Start document");
				                }
				            	
				            	if (eventType == XmlPullParser.END_DOCUMENT) {
				                    System.out.println("End document");
				                }
				            	
				            	if (eventType == XmlPullParser.START_TAG) {
				            		
				            		if(xpp.getName().equals("name")){
				            			tagok = true;
				            		}
				                }
				            	
				            	if (eventType == XmlPullParser.END_TAG) {
				                }
				            	
				            	if (eventType == XmlPullParser.TEXT) {
				            		if(tagok){
				            			quiz_call = xpp.getText().split(",");
				                	}
				            		quizs qs = new quizs(quiz_call[0],quiz_call[1],quiz_call[2],quiz_call[3],quiz_call[4],quiz_call[5],quiz_call[6],Integer.parseInt(quiz_call[7]),Integer.parseInt(quiz_call[8]),quiz_call[9],Integer.parseInt(quiz_call[10]));
						            
				            		items.event_list.add(qs);
				                }
				                eventType = xpp.next();
				            }
				            items.event_position = Integer.parseInt(quiz_call[11]);
				            nowloding.cancel();
				            if(items.event_list.get(0).getQuiz_type() == 3){
				            	Intent intent = new Intent(tour_lookback.this, tour_error_picture_search.class);
								startActivityForResult(intent, 0);
								finish();
				            }else if(items.event_list.get(0).getQuiz_type() == 1){
				            	Intent intent = new Intent(tour_lookback.this, tour_oxquiz.class);
								startActivityForResult(intent, 0);
								finish();
				            }
						} catch (MalformedURLException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						} catch (IOException e) {
							// TODO Auto-generated catch block								
							e.printStackTrace();
						}catch(Exception e){
							System.out.println(e.toString());
						}
					}
			    }).start();
			}
		});
		
		t_position8.setOnClickListener(new View.OnClickListener(){
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				items.event_list.removeAll(items.event_list);
				items.event_position = 0;
				
				final ProgressDialog nowloding = ProgressDialog.show(tour_lookback.this,"","미션을 불러오고 있습니다....",true);
				
				new Thread(new Runnable() {    
					@Override
					public void run() {				 
						try{
			    			
				    		URL url = null;
					        String resultString =null;
					  
				        	url = new URL(tour_oxquiz_recall+"?app_type="+items.apptype+"&lookback_name="+URLEncoder.encode(t_position8.getText().toString()));
						
				        	HttpURLConnection http = (HttpURLConnection)url.openConnection();  
				        	
				        	BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));  
				        	StringBuffer buffer = new StringBuffer();
							 
				        	int z;
				        	
							while((z=in.read()) != -1){
								buffer.append((char)z);
							}
							
							resultString= buffer.toString().trim();
							
				            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
				            factory.setNamespaceAware(true);
				            
				            boolean tagok = false;
				            
				            String[] quiz_call = null;
				            
				            XmlPullParser xpp = factory.newPullParser();
				            xpp.setInput(new StringReader(resultString));
				            
				            int eventType = xpp.getEventType();
				            
				            while (eventType != XmlPullParser.END_DOCUMENT) {
				                
				            	if(eventType == XmlPullParser.START_DOCUMENT) {
				                    System.out.println("Start document");
				                }
				            	
				            	if (eventType == XmlPullParser.END_DOCUMENT) {
				                    System.out.println("End document");
				                }
				            	
				            	if (eventType == XmlPullParser.START_TAG) {
				            		
				            		if(xpp.getName().equals("name")){
				            			tagok = true;
				            		}
				                }
				            	
				            	if (eventType == XmlPullParser.END_TAG) {
				                }
				            	
				            	if (eventType == XmlPullParser.TEXT) {
				            		if(tagok){
				            			quiz_call = xpp.getText().split(",");
				                	}
				            		quizs qs = new quizs(quiz_call[0],quiz_call[1],quiz_call[2],quiz_call[3],quiz_call[4],quiz_call[5],quiz_call[6],Integer.parseInt(quiz_call[7]),Integer.parseInt(quiz_call[8]),quiz_call[9],Integer.parseInt(quiz_call[10]));
						            
				            		items.event_list.add(qs);
				                }
				                eventType = xpp.next();
				            }
				            items.event_position = Integer.parseInt(quiz_call[11]);
				            nowloding.cancel();
				            if(items.event_list.get(0).getQuiz_type() == 3){
				            	Intent intent = new Intent(tour_lookback.this, tour_error_picture_search.class);
								startActivityForResult(intent, 0);
								finish();
				            }else if(items.event_list.get(0).getQuiz_type() == 1){
				            	Intent intent = new Intent(tour_lookback.this, tour_oxquiz.class);
								startActivityForResult(intent, 0);
								finish();
				            }
						} catch (MalformedURLException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						} catch (IOException e) {
							// TODO Auto-generated catch block								
							e.printStackTrace();
						}catch(Exception e){
							System.out.println(e.toString());
						}
					}
			    }).start();
			}
		});
		
		t_position9.setOnClickListener(new View.OnClickListener(){
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				items.event_list.removeAll(items.event_list);
				items.event_position = 0;
				
				final ProgressDialog nowloding = ProgressDialog.show(tour_lookback.this,"","미션을 불러오고 있습니다....",true);
				
				new Thread(new Runnable() {    
					@Override
					public void run() {				 
						try{
			    			
				    		URL url = null;
					        String resultString =null;
					  
				        	url = new URL(tour_oxquiz_recall+"?app_type="+items.apptype+"&lookback_name="+URLEncoder.encode(t_position9.getText().toString()));
						
				        	HttpURLConnection http = (HttpURLConnection)url.openConnection();  
				        	
				        	BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));  
				        	StringBuffer buffer = new StringBuffer();
							 
				        	int z;
				        	
							while((z=in.read()) != -1){
								buffer.append((char)z);
							}
							
							resultString= buffer.toString().trim();
							
				            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
				            factory.setNamespaceAware(true);
				            
				            boolean tagok = false;
				            
				            String[] quiz_call = null;
				            
				            XmlPullParser xpp = factory.newPullParser();
				            xpp.setInput(new StringReader(resultString));
				            
				            int eventType = xpp.getEventType();
				            
				            while (eventType != XmlPullParser.END_DOCUMENT) {
				                
				            	if(eventType == XmlPullParser.START_DOCUMENT) {
				                    System.out.println("Start document");
				                }
				            	
				            	if (eventType == XmlPullParser.END_DOCUMENT) {
				                    System.out.println("End document");
				                }
				            	
				            	if (eventType == XmlPullParser.START_TAG) {
				            		
				            		if(xpp.getName().equals("name")){
				            			tagok = true;
				            		}
				                }
				            	
				            	if (eventType == XmlPullParser.END_TAG) {
				                }
				            	
				            	if (eventType == XmlPullParser.TEXT) {
				            		if(tagok){
				            			quiz_call = xpp.getText().split(",");
				                	}
				            		quizs qs = new quizs(quiz_call[0],quiz_call[1],quiz_call[2],quiz_call[3],quiz_call[4],quiz_call[5],quiz_call[6],Integer.parseInt(quiz_call[7]),Integer.parseInt(quiz_call[8]),quiz_call[9],Integer.parseInt(quiz_call[10]));
						            
				            		items.event_list.add(qs);
				                }
				                eventType = xpp.next();
				            }
				            items.event_position = Integer.parseInt(quiz_call[11]);
				            nowloding.cancel();
				            if(items.event_list.get(0).getQuiz_type() == 3){
				            	Intent intent = new Intent(tour_lookback.this, tour_error_picture_search.class);
								startActivityForResult(intent, 0);
								finish();
				            }else if(items.event_list.get(0).getQuiz_type() == 1){
				            	Intent intent = new Intent(tour_lookback.this, tour_oxquiz.class);
								startActivityForResult(intent, 0);
								finish();
				            }
						} catch (MalformedURLException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						} catch (IOException e) {
							// TODO Auto-generated catch block								
							e.printStackTrace();
						}catch(Exception e){
							System.out.println(e.toString());
						}
					}
			    }).start();
			}
		});
		
		t_position10.setOnClickListener(new View.OnClickListener(){
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				items.event_list.removeAll(items.event_list);
				items.event_position = 0;
				
				final ProgressDialog nowloding = ProgressDialog.show(tour_lookback.this,"","미션을 불러오고 있습니다....",true);
				
				new Thread(new Runnable() {    
					@Override
					public void run() {				 
						try{
			    			
				    		URL url = null;
					        String resultString =null;
					  
				        	url = new URL(tour_oxquiz_recall+"?app_type="+items.apptype+"&lookback_name="+URLEncoder.encode(t_position10.getText().toString()));
						
				        	HttpURLConnection http = (HttpURLConnection)url.openConnection();  
				        	
				        	BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));  
				        	StringBuffer buffer = new StringBuffer();
							 
				        	int z;
				        	
							while((z=in.read()) != -1){
								buffer.append((char)z);
							}
							
							resultString= buffer.toString().trim();
							
				            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
				            factory.setNamespaceAware(true);
				            
				            boolean tagok = false;
				            
				            String[] quiz_call = null;
				            
				            XmlPullParser xpp = factory.newPullParser();
				            xpp.setInput(new StringReader(resultString));
				            
				            int eventType = xpp.getEventType();
				            
				            while (eventType != XmlPullParser.END_DOCUMENT) {
				                
				            	if(eventType == XmlPullParser.START_DOCUMENT) {
				                    System.out.println("Start document");
				                }
				            	
				            	if (eventType == XmlPullParser.END_DOCUMENT) {
				                    System.out.println("End document");
				                }
				            	
				            	if (eventType == XmlPullParser.START_TAG) {
				            		
				            		if(xpp.getName().equals("name")){
				            			tagok = true;
				            		}
				                }
				            	
				            	if (eventType == XmlPullParser.END_TAG) {
				                }
				            	
				            	if (eventType == XmlPullParser.TEXT) {
				            		if(tagok){
				            			quiz_call = xpp.getText().split(",");
				                	}
				            		quizs qs = new quizs(quiz_call[0],quiz_call[1],quiz_call[2],quiz_call[3],quiz_call[4],quiz_call[5],quiz_call[6],Integer.parseInt(quiz_call[7]),Integer.parseInt(quiz_call[8]),quiz_call[9],Integer.parseInt(quiz_call[10]));
						            
				            		items.event_list.add(qs);
				                }
				                eventType = xpp.next();
				            }
				            items.event_position = Integer.parseInt(quiz_call[11]);
				            nowloding.cancel();
				            if(items.event_list.get(0).getQuiz_type() == 3){
				            	Intent intent = new Intent(tour_lookback.this, tour_error_picture_search.class);
								startActivityForResult(intent, 0);
								finish();
				            }else if(items.event_list.get(0).getQuiz_type() == 1){
				            	Intent intent = new Intent(tour_lookback.this, tour_oxquiz.class);
								startActivityForResult(intent, 0);
								finish();
				            }
						} catch (MalformedURLException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						} catch (IOException e) {
							// TODO Auto-generated catch block								
							e.printStackTrace();
						}catch(Exception e){
							System.out.println(e.toString());
						}
					}
			    }).start();
			}
		});
		
		t_position11.setOnClickListener(new View.OnClickListener(){
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				items.event_list.removeAll(items.event_list);
				items.event_position = 0;
				
				final ProgressDialog nowloding = ProgressDialog.show(tour_lookback.this,"","미션을 불러오고 있습니다....",true);
				
				new Thread(new Runnable() {    
					@Override
					public void run() {				 
						try{
			    			
				    		URL url = null;
					        String resultString =null;
					  
				        	url = new URL(tour_oxquiz_recall+"?app_type="+items.apptype+"&lookback_name="+URLEncoder.encode(t_position11.getText().toString()));
						
				        	HttpURLConnection http = (HttpURLConnection)url.openConnection();  
				        	
				        	BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));  
				        	StringBuffer buffer = new StringBuffer();
							 
				        	int z;
				        	
							while((z=in.read()) != -1){
								buffer.append((char)z);
							}
							
							resultString= buffer.toString().trim();
							
				            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
				            factory.setNamespaceAware(true);
				            
				            boolean tagok = false;
				            
				            String[] quiz_call = null;
				            
				            XmlPullParser xpp = factory.newPullParser();
				            xpp.setInput(new StringReader(resultString));
				            
				            int eventType = xpp.getEventType();
				            
				            while (eventType != XmlPullParser.END_DOCUMENT) {
				                
				            	if(eventType == XmlPullParser.START_DOCUMENT) {
				                    System.out.println("Start document");
				                }
				            	
				            	if (eventType == XmlPullParser.END_DOCUMENT) {
				                    System.out.println("End document");
				                }
				            	
				            	if (eventType == XmlPullParser.START_TAG) {
				            		
				            		if(xpp.getName().equals("name")){
				            			tagok = true;
				            		}
				                }
				            	
				            	if (eventType == XmlPullParser.END_TAG) {
				                }
				            	
				            	if (eventType == XmlPullParser.TEXT) {
				            		if(tagok){
				            			quiz_call = xpp.getText().split(",");
				                	}
				            		quizs qs = new quizs(quiz_call[0],quiz_call[1],quiz_call[2],quiz_call[3],quiz_call[4],quiz_call[5],quiz_call[6],Integer.parseInt(quiz_call[7]),Integer.parseInt(quiz_call[8]),quiz_call[9],Integer.parseInt(quiz_call[10]));
						            
				            		items.event_list.add(qs);
				                }
				                eventType = xpp.next();
				            }
				            items.event_position = Integer.parseInt(quiz_call[11]);
				            nowloding.cancel();
				            if(items.event_list.get(0).getQuiz_type() == 3){
				            	Intent intent = new Intent(tour_lookback.this, tour_error_picture_search.class);
								startActivityForResult(intent, 0);
								finish();
				            }else if(items.event_list.get(0).getQuiz_type() == 1){
				            	Intent intent = new Intent(tour_lookback.this, tour_oxquiz.class);
								startActivityForResult(intent, 0);
								finish();
				            }
						} catch (MalformedURLException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						} catch (IOException e) {
							// TODO Auto-generated catch block								
							e.printStackTrace();
						}catch(Exception e){
							System.out.println(e.toString());
						}
					}
			    }).start();
			}
		});

        new Thread(new Runnable() {    
			@Override
			public void run() {
				URL url = null;
		        
		        try {
		        	
		        	url = new URL(tour_lookback_list+"?app_type="+items.apptype+"&c_code="+items.c_code);
				
			        HttpURLConnection http = (HttpURLConnection)url.openConnection();  
			
					BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));  
					StringBuffer buffer = new StringBuffer();
					 
					int c;  
					 
					while((c=in.read()) != -1){
						buffer.append((char)c);
					}
					
					resultString= buffer.toString().trim().split("@");
					
					runOnUiThread(new Runnable(){
			            @Override
			             public void run() {
			            	if(resultString.length == 1){
								t_position1.setText(resultString[0].trim());
							}else if(resultString.length == 2){
								t_position1.setText(resultString[0].trim());
								t_position2.setText(resultString[1].trim());
							}else if(resultString.length == 3){
								t_position1.setText(resultString[0].trim());
								t_position2.setText(resultString[1].trim());
								t_position3.setText(resultString[2].trim());
							}else if(resultString.length == 4){
								t_position1.setText(resultString[0].trim());
								t_position2.setText(resultString[1].trim());
								t_position3.setText(resultString[2].trim());
								t_position4.setText(resultString[3].trim());						
							}else if(resultString.length == 5){
								t_position1.setText(resultString[0].trim());
								t_position2.setText(resultString[1].trim());
								t_position3.setText(resultString[2].trim());
								t_position4.setText(resultString[3].trim());	
								t_position5.setText(resultString[4].trim());					
							}else if(resultString.length == 6){
								t_position1.setText(resultString[0].trim());
								t_position2.setText(resultString[1].trim());
								t_position3.setText(resultString[2].trim());
								t_position4.setText(resultString[3].trim());	
								t_position5.setText(resultString[4].trim());	
								t_position6.setText(resultString[5].trim());						
							}else if(resultString.length == 7){
								t_position1.setText(resultString[0].trim());
								t_position2.setText(resultString[1].trim());
								t_position3.setText(resultString[2].trim());
								t_position4.setText(resultString[3].trim());	
								t_position5.setText(resultString[4].trim());	
								t_position6.setText(resultString[5].trim());
								t_position7.setText(resultString[6].trim());
							}else if(resultString.length == 8){
								t_position1.setText(resultString[0].trim());
								t_position2.setText(resultString[1].trim());
								t_position3.setText(resultString[2].trim());
								t_position4.setText(resultString[3].trim());	
								t_position5.setText(resultString[4].trim());	
								t_position6.setText(resultString[5].trim());
								t_position7.setText(resultString[6].trim());
								t_position8.setText(resultString[7].trim());						
							}else if(resultString.length == 9){
								t_position1.setText(resultString[0].trim());
								t_position2.setText(resultString[1].trim());
								t_position3.setText(resultString[2].trim());
								t_position4.setText(resultString[3].trim());	
								t_position5.setText(resultString[4].trim());	
								t_position6.setText(resultString[5].trim());
								t_position7.setText(resultString[6].trim());
								t_position8.setText(resultString[7].trim());	
								t_position9.setText(resultString[8].trim());						
							}else if(resultString.length == 10){
								t_position1.setText(resultString[0].trim());
								t_position2.setText(resultString[1].trim());
								t_position3.setText(resultString[2].trim());
								t_position4.setText(resultString[3].trim());	
								t_position5.setText(resultString[4].trim());	
								t_position6.setText(resultString[5].trim());
								t_position7.setText(resultString[6].trim());
								t_position8.setText(resultString[7].trim());	
								t_position9.setText(resultString[8].trim());	
								t_position10.setText(resultString[9].trim());						
							}else if(resultString.length == 11){
								t_position1.setText(resultString[0].trim());
								t_position2.setText(resultString[1].trim());
								t_position3.setText(resultString[2].trim());
								t_position4.setText(resultString[3].trim());	
								t_position5.setText(resultString[4].trim());	
								t_position6.setText(resultString[5].trim());
								t_position7.setText(resultString[6].trim());
								t_position8.setText(resultString[7].trim());	
								t_position9.setText(resultString[8].trim());	
								t_position10.setText(resultString[9].trim());	
								t_position11.setText(resultString[10].trim());						
							}
			             }
			        });
					
					nowloding.cancel();
		        } catch (MalformedURLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					runOnUiThread(new Runnable(){
			            @Override
			             public void run() {
			            	nologin = new AlertDialog.Builder(tour_lookback.this);
			    			nologin.setTitle(items.appname);
			    			nologin.setMessage("서버에 접속이 되지 않습니다\n네트워크를 확인 후 다시 시도해 주세요");
			    			nologin.setIcon(R.drawable.icon);
			    			nologin.setPositiveButton("확 인", new DialogInterface.OnClickListener(){
			    				@Override
			    				public void onClick(DialogInterface dialog, int which) {
			    					// TODO Auto-generated method stub
			    					moveTaskToBack(true);
			    					android.os.Process.killProcess(android.os.Process.myPid());
			    				}
			    			});
			    			nologin.show();
			             }
			        });
					e.printStackTrace();
				}
			}
	    }).start();
        
    }
    
    public boolean onKeyDown( int KeyCode, KeyEvent event ){
		if( event.getAction() == KeyEvent.ACTION_DOWN ){
			if( KeyCode == KeyEvent.KEYCODE_BACK ){
				Intent intent = new Intent(tour_lookback.this, tour_myinfo.class);
				startActivityForResult(intent, 0);
				finish();
				
				return false;
			}
		}
		return super.onKeyDown(KeyCode, event);
	}
    public boolean onCreateOptionsMenu(Menu menu){
    	getMenuInflater().inflate(R.menu.quick, menu);
		return true;   	
    }

    public boolean onOptionsItemSelected(MenuItem item){
    	if(item.getItemId() == R.id.map_go){
    		startActivity(new Intent(this,tour_map.class));
    		finish();
    		return true;
    	}else if(item.getItemId() == R.id.event_go){
    		startActivity(new Intent(this,tour_event_info.class));
    		finish();
    		return true;
    	}else if(item.getItemId() == R.id.myinfo_go){
    		startActivity(new Intent(this,tour_myinfo.class));
    		finish();
    		return true;
    	}else if(item.getItemId() == R.id.coupon_go){
    		startActivity(new Intent(this,tour_coupon.class));
    		finish();
    		return true;
    	}else if(item.getItemId() == R.id.help_go){
    		startActivity(new Intent(this,tour_help.class));
    		finish();
    		return true;
    	}else if(item.getItemId() == R.id.oxquiz_go){
    		items.event_list.removeAll(items.event_list);

    		new Thread(new Runnable() {    
				@Override
				public void run() {
					runOnUiThread(new Runnable(){
						 @Override
						 public void run() {
							 AlertDialog.Builder q_level = new AlertDialog.Builder(tour_lookback.this)
				    			.setTitle(items.appname)
				    			.setMessage("퀴즈 난이도를 선택해 주세요")
				    			.setIcon(R.drawable.icon)
				    			.setPositiveButton("초급", new DialogInterface.OnClickListener(){
				    				@Override
				    				public void onClick(DialogInterface dialog, int which) {
				    					// TODO Auto-generated method stub
				    					final ProgressDialog nowloding = ProgressDialog.show(tour_lookback.this,"","OX 퀴즈를 불러오고 있습니다....",true);
				    			        
				    			        new Thread(new Runnable() {    
				    						@Override
				    						public void run() {				 
				    							try{
				    				    			
				    					    		URL url = null;
				    						        String resultString =null;
				    						  
				    					        	url = new URL(tour_oxquiz_call+"?app_type="+items.apptype+"&q_level="+items.q_level_easy);
				    							
				    					        	HttpURLConnection http = (HttpURLConnection)url.openConnection();  
				    					        	
				    					        	BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));  
				    					        	StringBuffer buffer = new StringBuffer();
				    								 
				    					        	int z;
				    					        	
				    								while((z=in.read()) != -1){
				    									buffer.append((char)z);
				    								}
				    								
				    								resultString= buffer.toString().trim();
				    								
				    					            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
				    					            factory.setNamespaceAware(true);
				    					            
				    					            boolean tagok = false;
				    					            
				    					            String[] quiz_call = null;
				    					            
				    					            XmlPullParser xpp = factory.newPullParser();
				    					            xpp.setInput(new StringReader(resultString));
				    					            
				    					            int eventType = xpp.getEventType();
				    					            
				    					            while (eventType != XmlPullParser.END_DOCUMENT) {
				    					                
				    					            	if(eventType == XmlPullParser.START_DOCUMENT) {
				    					                    System.out.println("Start document");
				    					                }
				    					            	
				    					            	if (eventType == XmlPullParser.END_DOCUMENT) {
				    					                    System.out.println("End document");
				    					                }
				    					            	
				    					            	if (eventType == XmlPullParser.START_TAG) {
				    					            		
				    					            		if(xpp.getName().equals("name")){
				    					            			tagok = true;
				    					            		}
				    					                }
				    					            	
				    					            	if (eventType == XmlPullParser.END_TAG) {
				    					                }
				    					            	
				    					            	if (eventType == XmlPullParser.TEXT) {
				    					            		if(tagok){
				    					            			quiz_call = xpp.getText().split(",");
				    					                	}
				    					            		quizs qs = new quizs("",quiz_call[0],"","","","","",Integer.parseInt(quiz_call[1]),0,quiz_call[2],Integer.parseInt(quiz_call[3]));
				    					            
				    					            		items.event_list.add(qs);
				    					                }
				    					                eventType = xpp.next();
				    					            }
				    					            
				    					            nowloding.cancel();
				    					            
				    					            Intent intent = new Intent(tour_lookback.this, tour_oxquiz.class);
				    								startActivityForResult(intent, 0);
				    								finish();
				    					    		
				    							} catch (MalformedURLException e) {
				    								// TODO Auto-generated catch block
				    								e.printStackTrace();
				    							} catch (IOException e) {
				    								// TODO Auto-generated catch block								
				    								runOnUiThread(new Runnable(){
				    						            @Override
				    						             public void run() {
				    						            	AlertDialog.Builder nologin = new AlertDialog.Builder(tour_lookback.this);
				    						    			nologin.setTitle(items.appname);
				    						    			nologin.setMessage("서버에 접속이 되지 않습니다\n네트워크를 확인 후 다시 시도해 주세요");
				    						    			nologin.setIcon(R.drawable.icon);
				    						    			nologin.setPositiveButton("확 인", new DialogInterface.OnClickListener(){
				    						    				@Override
				    						    				public void onClick(DialogInterface dialog, int which) {
				    						    					// TODO Auto-generated method stub
				    						    					moveTaskToBack(true);
				    						    					android.os.Process.killProcess(android.os.Process.myPid());
				    						    				}
				    						    			});
				    						    			nologin.show();
				    						             }
				    						        });
				    							}catch(Exception e){
				    								System.out.println(e.toString());
				    							}
				    						}
				    				    }).start();
				    				}
				    			})
				    			.setNeutralButton("고급", new DialogInterface.OnClickListener(){
				    				@Override
				    				public void onClick(DialogInterface dialog, int which) {
				    					// TODO Auto-generated method stub
				    					final ProgressDialog nowloding = ProgressDialog.show(tour_lookback.this,"","OX 퀴즈를 불러오고 있습니다....",true);
				    			        
				    			        new Thread(new Runnable() {    
				    						@Override
				    						public void run() {				 
				    							try{
				    				    			
				    					    		URL url = null;
				    						        String resultString =null;
				    						  
				    					        	url = new URL(tour_oxquiz_call+"?app_type="+items.apptype+"&q_level="+items.q_level_hard);
				    							
				    					        	HttpURLConnection http = (HttpURLConnection)url.openConnection();  
				    					        	
				    					        	BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));  
				    					        	StringBuffer buffer = new StringBuffer();
				    								 
				    					        	int z;
				    					        	
				    								while((z=in.read()) != -1){
				    									buffer.append((char)z);
				    								}
				    								
				    								resultString= buffer.toString().trim();
				    								
				    					            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
				    					            factory.setNamespaceAware(true);
				    					            
				    					            boolean tagok = false;
				    					            
				    					            String[] quiz_call = null;
				    					            
				    					            XmlPullParser xpp = factory.newPullParser();
				    					            xpp.setInput(new StringReader(resultString));
				    					            
				    					            int eventType = xpp.getEventType();
				    					            
				    					            while (eventType != XmlPullParser.END_DOCUMENT) {
				    					                
				    					            	if(eventType == XmlPullParser.START_DOCUMENT) {
				    					                    System.out.println("Start document");
				    					                }
				    					            	
				    					            	if (eventType == XmlPullParser.END_DOCUMENT) {
				    					                    System.out.println("End document");
				    					                }
				    					            	
				    					            	if (eventType == XmlPullParser.START_TAG) {
				    					            		
				    					            		if(xpp.getName().equals("name")){
				    					            			tagok = true;
				    					            		}
				    					                }
				    					            	
				    					            	if (eventType == XmlPullParser.END_TAG) {
				    					                }
				    					            	
				    					            	if (eventType == XmlPullParser.TEXT) {
				    					            		if(tagok){
				    					            			quiz_call = xpp.getText().split(",");
				    					                	}
				    					            		quizs qs = new quizs("",quiz_call[0],"","","","","",Integer.parseInt(quiz_call[1]),0,quiz_call[2],Integer.parseInt(quiz_call[3]));
				    					            
				    					            		items.event_list.add(qs);
				    					                }
				    					                eventType = xpp.next();
				    					            }
				    					            
				    					            nowloding.cancel();
				    					            
				    					            Intent intent = new Intent(tour_lookback.this, tour_oxquiz.class);
				    								startActivityForResult(intent, 0);
				    								finish();
				    					    		
				    							} catch (MalformedURLException e) {
				    								// TODO Auto-generated catch block
				    								e.printStackTrace();
				    							} catch (IOException e) {
				    								// TODO Auto-generated catch block								
				    								runOnUiThread(new Runnable(){
				    						            @Override
				    						             public void run() {
				    						            	AlertDialog.Builder nologin = new AlertDialog.Builder(tour_lookback.this);
				    						    			nologin.setTitle(items.appname);
				    						    			nologin.setMessage("서버에 접속이 되지 않습니다\n네트워크를 확인 후 다시 시도해 주세요");
				    						    			nologin.setIcon(R.drawable.icon);
				    						    			nologin.setPositiveButton("확 인", new DialogInterface.OnClickListener(){
				    						    				@Override
				    						    				public void onClick(DialogInterface dialog, int which) {
				    						    					// TODO Auto-generated method stub
				    						    					moveTaskToBack(true);
				    						    					android.os.Process.killProcess(android.os.Process.myPid());
				    						    				}
				    						    			});
				    						    			nologin.show();
				    						             }
				    						        });
				    							}catch(Exception e){
				    								System.out.println(e.toString());
				    							}
				    						}
				    				    }).start();
				    				}
				    			});
								q_level.show();
						 }
					 });
				}
		    }).start();
    	}
		return false;
    }
}
